package com.lanqiao.gxnushop.service;

import com.lanqiao.gxnushop.entity.UserLogins;
import com.lanqiao.gxnushop.mapper.UserLoginsMapper;
import com.lanqiao.gxnushop.valueObject.RegisterCount;
import com.lanqiao.gxnushop.valueObject.yhClass;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class UserLoginsService {

    @Autowired
    private UserLoginsMapper userLoginsMapper;
    /**增加用户，用户注册
     * 传入的参数需要有   用户密码 */
    public boolean add(UserLogins userLogins) {
        return userLoginsMapper.add(userLogins);
    }
    /**通过userId删除用户  返回boolean */
    public boolean delete(String userId) {
        return userLoginsMapper.delete(userId);
    }

    /**通过userId修改登录密码    返回boolean*/
    public boolean update(UserLogins userLogins) {
        return userLoginsMapper.update(userLogins);
    }

    /**用账户密码，查找用户，返回UserLogins对象*/
    public UserLogins select(UserLogins userLogins) {
        return userLoginsMapper.select(userLogins);
    }

    /**通过userId查找用户，返回UserLogins对象*/
    public UserLogins findById(String userId) {
        return userLoginsMapper.findById(userId);
    }

    /** 近 6 个月 每个月买家的注册量 */
    public ArrayList<RegisterCount> count() {
        return userLoginsMapper.count();
    }

    /** 近 6 个月 每个月商家的注册量 */
    public ArrayList<RegisterCount> countSeller() {
        return userLoginsMapper.countSeller();
    }
    /**用户类型数据 统计*/
    public ArrayList<yhClass> getYhClassCount() {
        return userLoginsMapper.getYhClassCount();
    }
}
